A graphics engine is a graphics library formed by performing encapsulation on graphics operations for ease of application development, and is provided by a system or designed by a developer. Each time an interface changes (starting, sliding, redirection, animation play, or the like), the graphics engine needs to draw an appropriate interface completely. When the graphics engine draws, a large quantity of Central Processing Unit (CPU), Graphics Processing Unit (GPU), and Double Data Rate (DDR) synchronous dynamic random access memory resources need to be consumed according to a quantity of pixels. In an ideal case, a quantity of pixels drawn by the graphics engine each time is a product of a width and a height of a screen; the quantity of pixels may exceed the product of the width and the height of the screen. Overdraw refers to a case in which a same pixel is repeatedly drawn.
In an existing method for eliminating overdraw, methods of intersection detection and drawing command combining are used during drawing, so as to eliminate overdraw.
However, in the existing method for eliminating overdraw, an irregular graph such as a rectangle rotated by any angle, a triangle, or an ellipse cannot be drawn, and time complexity of intersection detection is high. In many cases of drawing a graph, gains of eliminating overdraw are offset.